{% extends "base_page.html" %}

{% block page_title %} Config Step - 2{% endblock %}

{% block content %}
<div class="container">
    <form method="post" action="">
<table class="table table-bordered">
    <caption><h3>Config Details</h3></caption>
    <thead>
    <tr>
        <th>File Name</th>
        <th>Tree List</th>
        <th>Ticket Path</th>
    </tr>
    </thead>
    {% for k, v in resList %}
    <tr>
        <td>{{ k }}</td>
        <td>
            {% for tree in v[1] %}
                <label class="checkbox inline">
                    <input checked='checked' type="checkbox" name="{{ k }}-{{ tree }}" value="1"> {{ tree }}
                </label>
            {% endfor %}
        </td>
        <td>{{ v[0] }}</td>
    </tr>
        <input type="hidden" name="{{ k }}" value="{{ v[0] }}">
    {% endfor %}
</table>
    <p>
        <a class="btn btn-danger" href="/makeConfig-1">Something Wrong?</a>&nbsp;&nbsp;<button id="launchBTN" class="btn btn-success" type="submit" data-loading-text="Test is running...please wait until finish Page show up" autocomplete="off">Launch Test </button>
    </p>
{#    <button type="button" class="btn btn-info" onclick="getProgressBar.pauseFunc()">Test Button</button>#}
    </form>
{#    <div class="progress progress-striped active">#}
{#        <div class="bar" style="width: 43%;" id="p_bar"></div>#}
{#    </div>#}

</div>
{% endblock %}

{% block ownjs %}
    <script type="text/javascript">
        function PostSubmit() {
            var form = document.createElement("form");

            form.setAttribute("method", "POST");
            form.setAttribute("action", "/launchTest-1");

            {% for i in range(resList.__len__()) %}
                var hiddenField{{ i }} = document.createElement("input");
                hiddenField{{ i }}.setAttribute("type", "hidden");
                hiddenField{{ i }}.setAttribute("name", "{{ resList[i][0] }}");
                hiddenField{{ i }}.setAttribute("value", "{{ resList[i][1] }}");
                form.appendChild(hiddenField{{ i }});
            {% endfor %}

            document.body.appendChild(form);
            form.submit();
        }
    function SomeInfo() {
        alert("Test will last 1 to 10 min depends on the case count");
    }

    function loadState() {
        $('#launchBTN').button('loading')

    }

    </script>
    <script src='/static/js/own.js'></script>
{% endblock %}